import { defineStore } from 'pinia';
// import { OnePageType, DataItemInput, DataItemBody, DataItemBack } from '@/pages/interfaceto/type/index';

const versionString = import.meta.env.MODE === 'development' ? import.meta.env.VITE_APP_VERSION + '-dev' : import.meta.env.VITE_APP_VERSION;

export const useStore = defineStore('main', {
  state: () => ({
    debug: import.meta.env.MODE === 'development',
    version: versionString,
    isInitialized: false,
    count: 0,
    test: 0,
    // peopleOnePageNewData: {} as OnePageType,
    // dataSource1: [] as DataItemInput[],
    // dataSource2: [] as DataItemBody[],
    // dataSource3: [] as DataItemBack[],
  }),

  actions: {
    initApp() {
      this.isInitialized = true;
      console.log('app initialized!');
    },

    increment(value = 1) {
      this.count += value;
    },
    // getdataSourceone(data: DataItemInput[]) {
    //   this.dataSource1 = data;
    // },
    // getdataSourcetwo(data: DataItemBody[]) {
    //   this.dataSource2 = data;
    // },
    // getdataSourcethree(data: DataItemBack[]) {
    //   this.dataSource3 = data;
    // },
    // getPeopleOnePageNewData(data: OnePageType) {
    //   this.peopleOnePageNewData = data;
    // },
  },

  getters: {
    isReady: state => {
      return !state.isInitialized;
    },
  },
});
